home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / execl.man < prev    next >
Encoding:
Text File  |  1989-02-16  |  5.3 KB  |  133 lines

  1.  
  2.  
  3.  
  4. EXECL                 C Library Procedures                  EXECL
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      execl, execv, execle, execlp, execvp, exec, execve, exect,
  10.      environ - execute a file
  11.  
  12. SSYYNNOOPPSSIISS
  13.      eexxeeccll((nnaammee,, aarrgg00,, aarrgg11,, ......,, aarrggnn,, 00))
  14.      cchhaarr **nnaammee,, **aarrgg00,, **aarrgg11,, ......,, **aarrggnn;;
  15.  
  16.      eexxeeccvv((nnaammee,, aarrggvv))
  17.      cchhaarr **nnaammee,, **aarrggvv[[]];;
  18.  
  19.      eexxeeccllee((nnaammee,, aarrgg00,, aarrgg11,, ......,, aarrggnn,, 00,, eennvvpp))
  20.      cchhaarr **nnaammee,, **aarrgg00,, **aarrgg11,, ......,, **aarrggnn,, **eennvvpp[[]];;
  21.  
  22.      eexxeecctt((nnaammee,, aarrggvv,, eennvvpp))
  23.      cchhaarr **nnaammee,, **aarrggvv[[]],, **eennvvpp[[]];;
  24.  
  25.      eexxtteerrnn cchhaarr ****eennvviirroonn;;
  26.  
  27. DDEESSCCRRIIPPTTIIOONN
  28.      These routines provide various interfaces to the _e_x_e_c_v_e sys-
  29.      tem call.  Refer to _e_x_e_c_v_e(2) for a description of their
  30.      properties; only brief descriptions are provided here.
  31.  
  32.      _E_x_e_c in all its forms overlays the calling process with the
  33.      named file, then transfers to the entry point of the core
  34.      image of the file.  There can be no return from a successful
  35.      exec; the calling core image is lost.
  36.  
  37.      The _n_a_m_e argument is a pointer to the name of the file to be
  38.      executed.  The pointers _a_r_g[_0], _a_r_g[_1] ...  address null-
  39.      terminated strings.  Conventionally _a_r_g[_0] is the name of
  40.      the file.
  41.  
  42.      Two interfaces are available.  _e_x_e_c_l is useful when a known
  43.      file with known arguments is being called; the arguments to
  44.      _e_x_e_c_l are the character strings constituting the file and
  45.      the arguments; the first argument is conventionally the same
  46.      as the file name (or its last component).  A 0 argument must
  47.      end the argument list.
  48.  
  49.      The _e_x_e_c_v version is useful when the number of arguments is
  50.      unknown in advance; the arguments to _e_x_e_c_v are the name of
  51.      the file to be executed and a vector of strings containing
  52.      the arguments.  The last argument string must be followed by
  53.      a 0 pointer.
  54.  
  55.      The _e_x_e_c_t version is used when the executed file is to be
  56.      manipulated with _p_t_r_a_c_e(2).  The program is forced to single
  57.      step a single instruction giving the parent an opportunity
  58.      to manipulate its state.  On the VAX-11 this is done by set-
  59.      ting the trace bit in the process status longword.
  60.  
  61.  
  62.  
  63. Sprite v1.0              April 25, 1986                         1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. EXECL                 C Library Procedures                  EXECL
  71.  
  72.  
  73.  
  74.      When a C program is executed, it is called as follows:
  75.  
  76.           main(argc, argv, envp)
  77.           int argc;
  78.           char **argv, **envp;
  79.  
  80.      where _a_r_g_c is the argument count and _a_r_g_v is an array of
  81.      character pointers to the arguments themselves.  As indi-
  82.      cated, _a_r_g_c is conventionally at least one and the first
  83.      member of the array points to a string containing the name
  84.      of the file.
  85.  
  86.      _A_r_g_v is directly usable in another _e_x_e_c_v because _a_r_g_v[_a_r_g_c]
  87.      is 0.
  88.  
  89.      _E_n_v_p is a pointer to an array of strings that constitute the
  90.      _e_n_v_i_r_o_n_m_e_n_t of the process.  Each string consists of a name,
  91.      an "=", and a null-terminated value.  The array of pointers
  92.      is terminated by a null pointer.  The shell _s_h(1) passes an
  93.      environment entry for each global shell variable defined
  94.      when the program is called.  See _e_n_v_i_r_o_n(7) for some conven-
  95.      tionally used names.  The C run-time start-off routine
  96.      places a copy of _e_n_v_p in the global cell _e_n_v_i_r_o_n, which is
  97.      used by _e_x_e_c_v and _e_x_e_c_l to pass the environment to any sub-
  98.      programs executed by the current program.
  99.  
  100.      _E_x_e_c_l_p and _e_x_e_c_v_p are called with the same arguments as
  101.      _e_x_e_c_l and _e_x_e_c_v, but duplicate the shell's actions in
  102.      searching for an executable file in a list of directories.
  103.      The directory list is obtained from the environment.
  104.  
  105. FFIILLEESS
  106.      /bin/sh  shell, invoked if command file found by _e_x_e_c_l_p or
  107.      _e_x_e_c_v_p
  108.  
  109. SSEEEE AALLSSOO
  110.      execve(2), fork(2), environ(7), csh(1)
  111.  
  112. DDIIAAGGNNOOSSTTIICCSS
  113.      If the file cannot be found, if it is not executable, if it
  114.      does not start with a valid magic number (see _a._o_u_t(5)), if
  115.      maximum memory is exceeded, or if the arguments require too
  116.      much space, a return constitutes the diagnostic; the return
  117.      value is -1.  Even for the super-user, at least one of the
  118.      execute-permission bits must be set for a file to be exe-
  119.      cuted.
  120.  
  121. BBUUGGSS
  122.      If _e_x_e_c_v_p is called to execute a file that turns out to be a
  123.      shell command file, and if it is impossible to execute the
  124.      shell, the values of _a_r_g_v[_0] and _a_r_g_v[-_1] will be modified
  125.      before return.
  126.  
  127.  
  128.  
  129. Sprite v1.0              April 25, 1986                         2
  130.  
  131.  
  132.  
  133.